package top.kangyaocoding.ltzf.payment.nativepay;

import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import top.kangyaocoding.ltzf.payment.nativepay.model.GetRefundOrderResponse;
import top.kangyaocoding.ltzf.payment.nativepay.model.PrepayResponse;
import top.kangyaocoding.ltzf.payment.nativepay.model.QueryOrderByOutTradeNoResponse;
import top.kangyaocoding.ltzf.payment.nativepay.model.RefundOrderResponse;

/**
 * @Author K·Herbert
 * @Description 扫码支付API
 * @Date 2024-05-14 15:12
 */

public interface INativePayApi {
    @POST("api/wxpay/native")
    @FormUrlEncoded
    @Headers("Content-Type: application/x-www-form-urlencoded")
    Call<PrepayResponse> prePay(
            @Field("mch_id") String mchId,
            @Field("out_trade_no") String outTradeNo,
            @Field("total_fee") String totalFee,
            @Field("body") String body,
            @Field("timestamp") String timestamp,
            @Field("notify_url") String notifyUrl,
            @Field("attach") String attach,
            @Field("time_expire") String timeExpire,
            @Field("developer_appid") String developerAppid,
            @Field("sign") String sign
    );

    @FormUrlEncoded
    @POST("api/wxpay/get_pay_order")
    @Headers("Content-Type: application/x-www-form-urlencoded")
    Call<QueryOrderByOutTradeNoResponse> getPayOrder(
            @Field("mch_id") String mchId,
            @Field("out_trade_no") String outTradeNo,
            @Field("timestamp") String timestamp,
            @Field("sign") String sign
    );

    @FormUrlEncoded
    @POST("api/wxpay/refund_order")
    @Headers("Content-Type: application/x-www-form-urlencoded")
    Call<RefundOrderResponse> refundOrder(
            @Field("mch_id") String mchId,
            @Field("out_trade_no") String outTradeNo,
            @Field("out_refund_no") String outRefundNo,
            @Field("timestamp") String timestamp,
            @Field("refund_fee") String refundFee,
            @Field("refund_desc") String refundDesc,
            @Field("notify_url") String notifyUrl,
            @Field("sign") String sign
    );

    @FormUrlEncoded
    @POST("api/wxpay/get_refund_order")
    @Headers("Content-Type: application/x-www-form-urlencoded")
    Call<GetRefundOrderResponse> getRefundOrder(
            @Field("mch_id") String mchId,
            @Field("out_refund_no") String outRefundNo,
            @Field("timestamp") String timestamp,
            @Field("sign") String sign
    );

}
